package org.springblade.modules.admin.mapper;

import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springblade.modules.admin.dto.SimpleElevatorDetailDTO;
import org.springblade.modules.admin.entity.Building;
import org.springblade.modules.admin.entity.ElevatorDevice;
import org.springblade.modules.admin.vo.BuildingDeviceEleVO;
import org.springblade.modules.admin.vo.BuildingSelectListVO;
import org.springblade.modules.admin.vo.BuildingVO;
import org.springblade.modules.admin.vo.SimpleElevatorInfoVO;
import org.springblade.modules.system.vo.SimpleUserVO;

import java.util.List;
import java.util.Map;

public interface ElevatorDeviceMapper extends BaseMapper<ElevatorDevice> {

	IPage<BuildingVO> buildingPage(@Param("page") IPage<BuildingVO> page, @Param("building") Building building);

	@Select("SELECT device_id FROM blade_elevator_device WHERE is_deleted=0 AND (device_id IS NOT NULL AND STATUS=1)")
	List<String> getDeviceList();

	List<BuildingSelectListVO> buildingSelectDevices();

	List<SimpleUserVO> getSimpleUserByDeviceId(@Param("deviceId") String deviceId);

	SimpleElevatorDetailDTO getSimpleElevator(@Param("elevatorId") Long elevatorId,@Param("p") Integer p);

	List<SimpleUserVO> getSimpleUserByUserId(@Param("userIds") List<Long> userIds);

	List<SimpleUserVO> getSimpleUserByPhone(@Param("assessorPhones") List<String> assessorPhones);

	SimpleElevatorDetailDTO getSimpleElevatorById(Long elevatorId);

	List<BuildingDeviceEleVO> buildingDeviceEleList(@Param("buildingId") Long buildingId);

	List<Map<String, Object>> getSimpleUserByDeviceIds(@Param("deviceIds") List<String> deviceIds);

	List<Map<String, Object>> getSimpleUserByElevatorIds(@Param("elevatorIds") List<Long> elevatorIds);

	@InterceptorIgnore(tenantLine = "on")
	SimpleElevatorInfoVO getSimpleElevatorInfo(@Param("deviceId") String deviceId);

	@InterceptorIgnore(tenantLine = "on")
	SimpleElevatorInfoVO getSimpleElevatorInfoByElevatorId(@Param("elevatorId") Long elevatorId);
}
